Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent CHANGE_SLAB_TYPE from leaving room information on slabs #3422

Merged
merged 1 commit into from
Aug 25, 2024

Conversation

Loobinex
Copy link
Member

If the CHANGE_SLAB_TYPE script command is used to change a room slab into another room slab, it would leave the old room present in the slab information.

Function do_slab_efficiency_alteration would do this:

struct SlabAttr* slbattr = get_slab_attrs(slb);
        if (slbattr->category == SlbAtCtg_RoomInterior)
        {
            struct Room* room = slab_room_get(sslb_x, sslb_y);

And find a room of type NULL, causing several log errors and related issues, possibly also player notifications when the room was destroyed.
This PR cleans that up.

To reproduce the original issue:

  1. Run this map: map30117.zip
  2. Press ~ to see logging
  3. Wait for 140 gameturns to see rooms get replaced
    -> Notice a ! message that says a room is destroyed, with the eye at pos (0,0).

@AdamPlenty
Copy link
Contributor

I thought that placing a room slab doesn't actually make a room, or is that just for the cheat?

@Loobinex
Copy link
Member Author

I thought that placing a room slab doesn't actually make a room, or is that just for the cheat?

When placing it with a script we do the same room integration as gets done when placing a room through the normal gui. Or we try to at least.

Copy link
Contributor

@AdamPlenty AdamPlenty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the master, I get the warning. On this PR, I do not.

@Loobinex Loobinex merged commit b37484c into master Aug 25, 2024
1 check passed
@Loobinex Loobinex deleted the cleanupoldroom branch August 25, 2024 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants